<?php echo $this->Session->flash(); ?>

<script>
    $(document).ready(function(){

        $("input[type=checkbox]").click(
        function() {
            if($(this).attr('className')=='tipo3'){
                $("#calificacion").attr("value", 3);
                $(".tipo1").attr("checked",false);
                $(".tipo2").attr("checked",false);
            }else{
                if($(this).attr('className')=='tipo2'){
                    $("#calificacion").attr("value", 2);
                    $(".tipo1").attr("checked",false);
                    $(".tipo3").attr("checked",false);
                }else
                    if($(this).attr('className')=='tipo1'){
                        $("#calificacion").attr("value", 1);
                        $(".tipo2").attr("checked",false);
                        $(".tipo3").attr("checked",false);
                    }


            }

        }
    )



    });


    function setcheck(){
               
        

    }

  


</script>

<?php
echo $form->create('ProyectRequirement');
echo $form->input("ProyectRequirement.id");
?>
<h1><?php echo $this->data['Proyect']['codigo'] ?></h1>
<br>

<h1><?php echo $this->data['Requirement']['texto'] ?></h1>
<br>


<table border="1" width="100%" >
    <tbody>


        <?php
        foreach ($condiciones as $con):
            $ch = "";
            foreach ($chequeados as $val) {
                if ($con['RequirementFault']['id'] == $val['ProyectRequirementsRequirementFault']['requirement_fault_id']) {
                    $ch = "checked";
                }
            }
            ?>
            <tr>
                <td width="20%"><?php echo $form->input("RequirementFault.id", array('type' => 'checkbox', 'label' => '', 'class' => 'tipo' . $con['RequirementFault']['tipo'], 'value' => $con['RequirementFault']['id'], 'name' => 'checked[]', 'checked' => $ch)); ?></td>
                <td width="80%" style="text-align: justify"><label><?php echo $con['RequirementFault']['nombre'] ?></label></td>
            </tr>



<?php endforeach; ?>


    </tbody>
</table>
<?php
echo $form->hidden("ProyectRequirement.calificacion", array('id' => 'calificacion'));
?>
<div id="loading" style="display: none;">
<?php echo $html->image('loading.gif', array('border' => "0", 'align' => 'center')); ?>
</div>
<?php
if ($est == 0)
    echo $ajax->submit('Guardar', array('url' => array('controller' => 'ProyectRequirements', 'action' => 'edit'), 'update' => 'content', 'complete' => 'cargar()', 'indicator' => 'loading'));
echo $form->end();

// echo $ajax->link("REGRESAR",array('controller'=>'ProyectRequirements', "action"=>"index",$this->data['ProyectRequirement']['proyect_id']),array('update'=>'content','complete'=>'cargar()'))
?>
